package com.atguigu.gmall.item.service.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.item.service.ItemService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author Fxz
 * @version 1.0
 * @date 2022-02-07 17:00
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/item")
public class ItemController {

	private final ItemService itemService;

	@GetMapping("{skuId}")
	public Result<Map<String, Object>> getItemById(@PathVariable Long skuId) {
		return Result.ok(itemService.getItemBySkuId(skuId));
	}

}
